<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
    <script src="./utils/LineString.js"></script>
</head>

<body>
    <button onclick="addLine()">添加线要素</button>
    <div id="map">
    </div>
    <script>
        /* ip默认参数是localhost port 6163 */
        var docLayer = new Zondy.Map.Doc("", "xzd_line", {
        })
        var map = new ol.Map({
            target: "map",
            layers: [gaode, docLayer],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        function addLine(){
            /* 定义传递的参数 */
            var position =[[114,30],[114,20]]
            var attr= [
                {name:"name",value:"黄河",type:"string"},
                {name:"length",value:2000,type:"int"}
            ]
            var service = {
                name:"xzd_line",
                layerId:1
            }
            LineString.add({
                position,
                attr,
                service,
                docLayer
            })

        }
   </script>
</body>

</html>